home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 44
/
Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso
/
-in_the_mag-
/
basics
/
prime_tests
/
primes.amos
/
primes.amosSourceCode
Wrap
AMOS Source Code
|
1999-07-24
|
614b
|
17 lines
' This program finds the prime-numbers from 2 to 3000 by a simplistic
' method. It was originally written as a test of the Cursor compiler
' where the compiled program needs 12 seconds to find the first 1000
' primes; with AmigaBASIC it takes about 139 seconds on an Amiga 500
' This is essentially just a test of overheads plus MOD, FOR and IF.
'
Print "Searching for prime numbers from 2 to 3000:"
BEGINTIME=Timer
For A=2 To 3000
For B=3 To A-1
If A mod B=0 Then Goto HOPOUT
Next B
Rem PRINT a
HOPOUT:
Next A
Print "time needed:"+Str$((Timer-BEGINTIME)*20)+" mS."
While Inkey$="" : Wend